package com.wholesale.beans;

import org.json.JSONException;
import org.json.JSONObject;

public class UserAddress {

	private String address;
	private int addressId;
	private String addressName;
	private String bestTime;
	private int city;
	private String consignee;
	private int country;
	private int district;
	private String email;
	private String mobile;
	private int province;
	private String signBuilding;
	private String tel;
	private int userId;
	private String zipcode;
	private String countryName;
	private String provinceName;
	private String cityName;
	private String districtName;
	private JSONObject jsonObject;

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public int getAddressId() {
		return addressId;
	}

	public void setAddressId(int addressId) {
		this.addressId = addressId;
	}

	public String getAddressName() {
		return addressName;
	}

	public void setAddressName(String addressName) {
		this.addressName = addressName;
	}

	public String getBestTime() {
		return bestTime;
	}

	public void setBestTime(String bestTime) {
		this.bestTime = bestTime;
	}

	public int getCity() {
		return city;
	}

	public void setCity(int city) {
		this.city = city;
	}

	public String getConsignee() {
		return consignee;
	}

	public void setConsignee(String consignee) {
		this.consignee = consignee;
	}

	public int getCountry() {
		return country;
	}

	public void setCountry(int country) {
		this.country = country;
	}

	public int getDistrict() {
		return district;
	}

	public void setDistrict(int district) {
		this.district = district;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getMobile() {
		return mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	public int getProvince() {
		return province;
	}

	public void setProvince(int province) {
		this.province = province;
	}

	public String getSignBuilding() {
		return signBuilding;
	}

	public void setSignBuilding(String signBuilding) {
		this.signBuilding = signBuilding;
	}

	public String getTel() {

		return tel;
	}

	public void setTel(String tel) {
		this.tel = tel;
	}

	public int getUserId() {
		return userId;
	}

	public void setUserId(int userId) {
		this.userId = userId;
	}

	public String getZipcode() {
		return zipcode;
	}

	public void setZipcode(String zipcode) {
		this.zipcode = zipcode;
	}

	public String getCountryName() {
		return countryName;
	}

	public void setCountryName(String countryName) {
		this.countryName = countryName;
	}

	public String getProvinceName() {
		return provinceName;
	}

	public void setProvinceName(String provinceName) {
		this.provinceName = provinceName;
	}

	public String getCityName() {
		return cityName;
	}

	public void setCityName(String cityName) {
		this.cityName = cityName;
	}

	public String getDistrictName() {
		return districtName;
	}

	public void setDistrictName(String districtName) {
		this.districtName = districtName;
	}

	public String toJsonStringForDelete() {
		JSONObject jsonObject = new JSONObject();
		try {
			jsonObject.put("addressId", addressId);
			jsonObject.put("userId", userId);
		} catch (Exception e) {
		}
		return jsonObject.toString();
	}

	public String toJsonString() {
		JSONObject jsonObject = new JSONObject();
		try {
			jsonObject.put("addressId", addressId);
			jsonObject.put("addressName", addressName);
			jsonObject.put("userId", userId);
			jsonObject.put("consignee", consignee);
			jsonObject.put("email", email);
			jsonObject.put("country", country);
			jsonObject.put("province", province);
			jsonObject.put("city", city);
			jsonObject.put("district", district);
			jsonObject.put("address", address);
			jsonObject.put("zipcode", zipcode);
			jsonObject.put("tel", tel);
			jsonObject.put("mobile", mobile);
			jsonObject.put("signBuilding", signBuilding);
			jsonObject.put("bestTime", bestTime);
			jsonObject.put("countryName", countryName);
			jsonObject.put("provinceName", provinceName);
			jsonObject.put("cityName", cityName);
			jsonObject.put("districtName", districtName);
		} catch (Exception e) {
		}
		return jsonObject.toString();
	}

	public void jsonAnalytic(String jsonString) {

		try {
			jsonObject = new JSONObject(jsonString);
			jsonAnalytic(jsonObject);
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	public void jsonAnalytic(JSONObject jsonObject) {
		this.jsonObject = jsonObject;

		try {
			addressId = jsonObject.getInt("addressId");
		} catch (JSONException e) {
			e.printStackTrace();
		}
		try {
			addressName = jsonObject.getString("addressName");
		} catch (JSONException e) {
			e.printStackTrace();
		}
		try {
			userId = jsonObject.getInt("userId");
		} catch (JSONException e) {
			e.printStackTrace();
		}
		try {
			consignee = jsonObject.getString("consignee");
		} catch (JSONException e) {
			e.printStackTrace();
		}
		try {
			email = jsonObject.getString("email");
		} catch (JSONException e) {
			e.printStackTrace();
		}
		try {
			country = jsonObject.getInt("country");
		} catch (JSONException e) {
			e.printStackTrace();
		}
		try {
			province = jsonObject.getInt("province");
		} catch (JSONException e) {
			e.printStackTrace();
		}
		try {
			city = jsonObject.getInt("city");
		} catch (JSONException e) {
			e.printStackTrace();
		}
		try {
			district = jsonObject.getInt("district");
		} catch (JSONException e) {
			e.printStackTrace();
		}
		try {
			address = jsonObject.getString("address");
		} catch (JSONException e) {
			e.printStackTrace();
		}
		try {
			zipcode = jsonObject.getString("zipcode");
		} catch (JSONException e) {
			e.printStackTrace();
		}
		try {
			tel = jsonObject.getString("tel");
		} catch (JSONException e) {
			e.printStackTrace();
		}
		try {
			mobile = jsonObject.getString("mobile");
		} catch (JSONException e) {
			e.printStackTrace();
		}
		try {
			signBuilding = jsonObject.getString("signBuilding");
		} catch (JSONException e) {
			e.printStackTrace();
		}
		try {
			bestTime = jsonObject.getString("bestTime");
		} catch (JSONException e) {
			e.printStackTrace();
		}
		try {
			countryName = jsonObject.getString("countryName");
		} catch (JSONException e) {
			e.printStackTrace();
		}
		try {
			provinceName = jsonObject.getString("provinceName");
		} catch (JSONException e) {
			e.printStackTrace();
		}
		try {
			cityName = jsonObject.getString("cityName");
		} catch (JSONException e) {
			e.printStackTrace();
		}
		try {
			districtName = jsonObject.getString("districtName");
		} catch (JSONException e) {
			e.printStackTrace();
		}

	}
}
